package com.wty.cmims.controller;

import com.wty.cmims.pojo.ResponseResult;
import com.wty.cmims.service.MedicalHistoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/medicalHistory")
@Tag(name = "居民病历", description = "社区医疗信息后台管理系统api接口")
public class MedicalHistoryController {
    @Autowired
    private MedicalHistoryService medicalHistoryService;
    // 居民病历获取
    @PostMapping("/findMedicalHistoryByAppointmentId/{id}")
    @Operation(summary = "居民病历获取", description = "居民病历获取")
    @Parameter(name = "id",description = "居民ID")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<Map<String, Object>> medicalHistoryFindById(@PathVariable("id") Integer AppointmentId){
        return medicalHistoryService.medicalHistoryFindById(AppointmentId);
    }

    // 居民病历修改
    @PutMapping("/updateMedicalHistory")
    @Operation(summary = "居民病历修改", description = "居民病历修改")
    @Parameter(name = "paramsMap",description = "参数列表")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<Void> medicalHistoryUpdate(@RequestBody Map<String,Object> paramsMap){
        return medicalHistoryService.medicalHistoryUpdate(paramsMap);
    }

    // 居民病历添加
    @PostMapping("/addMedicalHistory")
    @Operation(summary = "居民病历添加", description = "居民病历添加")
    @Parameter(name = "paramsMap",description = "参数列表")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<Void> medicalHistoryAdd(@RequestBody Map<String,Object> paramsMap){
        return medicalHistoryService.medicalHistoryAdd(paramsMap);
    }

    // 居民病历列表获取
    @PostMapping("/findMedicalHistoryListByResidentId")
    @Operation(summary = "居民病历获取", description = "居民病历获取")
    @Parameter(name = "id",description = "居民ID")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<Map<String, Object>> medicalHistoryListFindByResidentId(@RequestBody Map<String,Object> paramsMap){
        return medicalHistoryService.medicalHistoryListFindByResidentId(paramsMap);
    }
}